From 51beb18b3709be2b798b7c14352c4aafccd20ed2 Mon Sep 17 00:00:00 2001
From: Mqdd <ahmadmiqdad27@gmail.com>
Date: Wed, 25 Feb 2026 10:01:59 +0700
Subject: <Miqdad> when numfound = 0 redirect to 404 searchkey

---
 src/pages/searchkey/[slug].jsx | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src/pages/searchkey/[slug].jsx')

diff --git a/src/pages/searchkey/[slug].jsx b/src/pages/searchkey/[slug].jsx
index fbe72dae..06c7252b 100644
--- a/src/pages/searchkey/[slug].jsx
+++ b/src/pages/searchkey/[slug].jsx
@@ -38,6 +38,11 @@ export default function KeywordPage() {
 
       setResult(res?.data?.response?.docs?.[0] || null);
     } catch (e) {
+      if (e.response?.status === 404) {
+        route.replace('/404'); // 🔥 redirect ke 404
+        return;
+      }
+
       console.error('Fetching searchkey failed:', e);
     }
   };
-- 
cgit v1.2.3

